//
//  UseDisclosureGroup.swift
//  learn-ios
//
//  Created by Dong on 2022/4/6.
//

import SwiftUI

struct UseDisclosureGroup: View {
    @State private var isOn: Bool = false
    @State private var isExpanded: Bool = true
    var body: some View {
        VStack {
            // 披露视图: 根据披露控件的状态显示或隐藏另一个内容视图的视图。
            DisclosureGroup("披露视图", isExpanded: $isExpanded) {
                Toggle("显示下一级", isOn: $isOn)
                DisclosureGroup("11", isExpanded: $isOn) {
                    Text("Text")
                }
            }
            
            Spacer()
        }
    }
}

struct UseDisclosureGroup_Previews: PreviewProvider {
    static var previews: some View {
        UseDisclosureGroup()
    }
}
